<?php 
defined("C5_EXECUTE") or die(_("Access Denied."));
$form	= Loader::helper("form");
$page	= Loader::helper("form/page_selector");
$user	= Loader::helper("form/user_selector");
$date	= Loader::helper("form/date_time");
//$ah		= Loader::helper('concrete/interface');

$hatom->getEntries();

?>
<div id="block">
	<h3><?	echo $form->label("hAtomTitle", t("hAtom Title")); ?></h3>
	<p><? echo $form->text("hAtomTitle", $hatom->hAtomTitle); ?></p>
</div>

<div id="hatomForm">
	<div id="hatom">
		<?	echo $form->hidden("rowid", 0); ?>
		<dl>
			<dt><?	echo $form->label("title", t("title")); ?></dt>
			<dd><?	echo $form->text("title", $hatom->title); ?></dd>
	
			<dt><?	echo $form->label("published", t("published")); ?></dt>
			<dd><?	echo $date->datetime("published", $hatom->published); ?></dd>
	
			<dt><?	echo $form->label("updated", t("updated")); ?></dt>
			<dd><?	echo $date->datetime("updated", $hatom->updated); ?></dd>
	
			<dt><?	echo $form->label("author", t("author")); ?></dt>
			<dd><? echo $user->selectUser("author", $hatom->author); ?></dd>
	
			<dt><?	echo $form->label("summary", t("summary")); ?></dt>
			<dd><?	echo $form->text("summary", ""); ?></dd>
	
			<dt><?	echo $form->label("content", t("content")); ?></dt>
			<dd><?	echo $form->textarea("content", $hatom->content); ?></dd>
	
			<dt><? echo $form->label("pid", t("entry link")); ?></dt>
			<dd><? echo $page->selectPage("pid", $hatom->pid); ?></dd>
		</dl>
		<p><a id="add" href="#"><?php echo t("Add") ?></a>&nbsp;<a id="update" href="#"><?php echo t("Update") ?></a></p>
	</div>

	<table id="feedList">
		<tr>
			<th>title</th>
			<th>summary</th>
			<th>publish</th>
			<th>update</th>
			<th>edit</th>
			<th>delete</th>
		</tr>
		<?php
			if (count($hatom->entries) > 0) {
				foreach ($hatom->entries as $key => $entry) {
		 ?>
			<tr id="rid<?php echo $key + 1; ?>">
				<td><? echo $entry["title"] ?></td>
				<td><? echo $entry["summary"] ?></td>
				<td><? echo $entry["published"] ?></td>
				<td><? echo $entry["updated"] ?></td>
				<td><a class="edit" href="#">edit</a></td>
				<td><a class="delete" href="#">delete</a></td>
			</tr>
		<?php }} ?>
	</table>
	<?php
		if (count($hatom->entries) > 0) {
			foreach ($hatom->entries as $key => $entry) {
				$id = $key + 1;

				$published_dt	= date('Y-m-d', strtotime($entry["published"] ));
				$published_h	= date('h', strtotime($entry["published"] ));
				$published_m	= date('i', strtotime($entry["published"] ));
				$published_a	= date('A', strtotime($entry["published"] ));

				$updated_dt	= date('Y-m-d', strtotime($entry["updated"] ));
				$updated_h		= date('h', strtotime($entry["updated"] ));
				$updated_m	= date('i', strtotime($entry["updated"] ));
				$updated_a		= date('A', strtotime($entry["updated"] ));
	 ?>
			<input id="p<?php echo $id; ?>RowId" type="hidden" name="rowid[]" value="<?php echo $id ?>" />
			<input id="p<?php echo $id; ?>Title" type="hidden" name="title[]" value="<?php echo $entry["title"]  ?>" />
			<input id="p<?php echo $id; ?>Published" type="hidden" name="published[]" value="<?php echo $entry["published"]  ?>" />
			<input id="p<?php echo $id; ?>Updated" type="hidden" name="updated[]" value="<?php echo $entry["updated"]  ?>" />
			<input id="p<?php echo $id; ?>Author" type="hidden" name="author[]" value="<?php echo $entry["author"]  ?>" />
			<input id="p<?php echo $id; ?>Summary" type="hidden" name="summary[]" value="<?php echo $entry["summary"]  ?>" />
			<input id="p<?php echo $id; ?>Content" type="hidden" name="content[]" value="<?php echo $entry["content"]  ?>" />
			<input id="p<?php echo $id; ?>Pid" type="hidden" name="pid[]" value="<?php echo $entry["pid"]  ?>" />
			<input id="p<?php echo $id; ?>Published_Dt" type="hidden" name="published_dt[]" value="<?php echo $published_dt  ?>" />
			<input id="p<?php echo $id; ?>Published_H" type="hidden" name="published_h[]" value="<?php echo $published_h  ?>" />
			<input id="p<?php echo $id; ?>Published_M" type="hidden" name="published_m[]" value="<?php echo $published_m ?>" />
			<input id="p<?php echo $id; ?>Published_A" type="hidden" name="published_a[]" value="<?php echo $published_a  ?>" />
			<input id="p<?php echo $id; ?>Updated_Dt" type="hidden" name="updated_dt[]" value="<?php echo $updated_dt  ?>" />
			<input id="p<?php echo $id; ?>Updated_H" type="hidden" name="updated_h[]" value="<?php echo $updated_h  ?>" />
			<input id="p<?php echo $id; ?>Updated_M" type="hidden" name="updated_m[]" value="<?php echo $updated_m  ?>" />
			<input id="p<?php echo $id; ?>Updated_A" type="hidden" name="updated_a[]" value="<?php echo $updated_a  ?>" />
	<?php }} ?>
</div>
